# str = "hello Python! I love Python programming"
# print(str.strip())
# print(str.lstrip())
# print(str.title())
# str = 'hello'
# print(str.ljust(12,'*'))
# print(str.rjust(12,'*'))
# print(str.center(12,'*'))
# print(str.startswith('I', 14, 23))
# print(str.endswith("ing"))
# str1 = "hello"
# str2 = 'hello123'
# str3 = '123456'
# str4 = '    '
# print(str1.isalpha())
# print(str2.isalpha())
# print(str2.isdigit())
# print(str3.isdigit())
# print(str2.isalnum())  # 字符串中至少有一个字符且所有字符都是字母或者数字则返回True,否则返回False.
# print(str3.isalnum())
# print(str1.isalnum())
# print(str4.isspace())  # 字符串中全是空格返回True.


# 集合 无序，不支持下标；去重
# 创建集合{}，（），但创建空集用set()，{}用来创建空字典
# str = set('abcde')
# print(str)  # 每次运行结果不一样
# str1 = {1, 2, 6, 11, 10, 25, 2, 7, 9, 1}  # 去重，从小到大排序
# print(str1)

# s1 = set()
# print(type(s1))
#
# s2 = {}
# print(type(s2))

# str2 = {10,12}
# # print(str2.add(15))错误
# str2.add(15)  # 增加数据
# print(str2)
# str2.update('abc')  # 增加数据
# print(str2)
# str2.remove(10)  # 删除数据，不存在则报错
# print(str2)
# str2.discard(10)  # 删除数据，若不存在也不会报错
# print(str2)
# str2.pop()  # 随机删除集合中的某个数据，并返回这个数据
# print(str2.pop())
# print('12' in str2)  # 判断数据是否在集合里面

# 元组（），数据可以是不同的数据类型；数据不可修改
# t1 = (10,)  # 一个数据后面要加逗号
# print(type(t1))
# t2 = (10)
# print(type(t2))
# tuple1 = ('aa', 'bb', 'cc', 'dd', 'cc', ['aa', 'bb', 'cc'])
# print(tuple1[2])
# print(tuple1.index('bb'))
# print(tuple1.count('cc'))
# print(len(tuple1))


# 列表 可一次性存储多个数据（可以是不同数据类型）
# name_list = ['Lily', 'Tom', 'Mark', 'Bob','Lily']
# print(name_list.index('Lily',3,5))  # 存在返回下标，不存在则报错
# print(name_list.count('Lily'))
# print(len(name_list))
# name = input('请输入你要搜索的名字：')
# if name in name_list:
#     print(f'你输入的名字是{name},名字已存在')
# else:
#     print(f'你输入的名字是{name},名字不存在')
# name_list.append('Mary')  # 整个序列添加
# print(name_list)
# name_list.extend('Mary')  # 逐个添加
# print(name_list)
# name_list.extend(['Mary', 'Alex'])  # 适合将一个列表添加到另一个列表里面
# print(name_list)
# name_list.insert(5,'Tomas')  # 插入（位置下标，数据）
# print(name_list)
# del name_list[7]  # 删除数据
# print(name_list)
# name_list.pop()  # 删除指定下标的数据，默认为最后一个
# print(name_list)
# name_list.remove('Mary')  # 删除指定数据
# print(name_list)
# # name_list.clear()  # 清空列表
# # print(name_list)
# name_list[0] = 'Rosy'  # 修改数据
# print(name_list)
# list1 = [1,2,10,9,26,13,8]
# list1.sort()  # 排序从小到大
# list1.reverse()  # 翻转，降序
# print(list1)
# name_list1 = name_list.copy()
# print(name_list1)
# i = 0                # 列表循环遍历
# while i < len(name_list):
#     print(name_list[i])
#     i += 1

# for i in name_list:
#     print(i)


# 字典 键值对，不支持下标
# dict1 = {'name': 'Tom', 'age': '18', 'gender': '男'}
# dict1['id'] = 110  # 修改增加
# print(dict1)
# dict1['name'] = 'Bob'
# print(dict1)
# print(dict1.get('name'))  # 获得key值
# print(dict1.get('hobby', 'PingPang'))
# print(dict1.keys())   # 遍历字典的key值
# print(dict1.values())   # 遍历字典的value值
# for key in dict1.keys():   # 遍历字典的key值
#     print(key)
# for value in dict1.values():   # 遍历字典的value值
#     print(value)
# for item in dict1.items():
#     print(item)
# for key, value in dict1.items():
#     print(f'{key}={value}')

# dict2 = {}   # 创建空字典
# dict3 = dict()


# 创建一个集合，该集合包含0到9之间的所有偶数
# s = set()
# for i in range(0, 10):
#     if i % 2 == 0:
#         s.add(i)
# print(s)
# s = {i for i in range(0,10) if i % 2 == 0}
# print(s)


# 条件语句
# age = int(input("请输入你的年龄："))

# if 18 <= age <= 60:
#     print("合法工作年龄")
# elif age > 60:
#     print("您已到法定退休年龄")
# else:
#     print("童工，不合法")

# money = 1
# seat = 0
# if money == 1:
#     print("可以上车")
#     if seat == 1:
#         print("有空座位")
#     else:
#         print("没有空座位")
# else:
#     print("没钱，不能上车")


# while循环
# s = 0  # 计算1-100和
# i = 1
# while i <= 100:
#     s += i
#     i += 1
# print(s)


# j = 0  # 打印五行星号
# while j < 4:
#     i = 0
#     while i <= 4:
#         print('*', end='')
#         i += 1
#     print()
#     j += 1


# 打印三角形
# j = 0
# while j < 4:
#     i = 0
#     while i <= j:
#         print('*', end='')
#         i += 1
#     print()
#     j += 1


# 乘法表
# j = 1
# while j <= 9:
#     i = 1
#     while i <= j:
#         print(f'{i}*{j}={j * i}', end='\t')
#         i += 1
#     print()
#     j += 1

# str1 = 'itheima'
# for i in str1:
#     if i == 'e':
#         print('遇到e不打印')
#         break            # continue
#     print(i)
# else:
#     print('循环正常结束后执行的语句')


# 自己输入一个字符串，然后将其颠倒过来
# list=[]
# for x in range(len(str1)-1,-1,-1):
#     list.append(str[x])
# print(''.join(list))


# 定义加减乘除运算
def add(x, y):
    z = x + y
    return z


def cha(x, y):
    z = x - y
    return abs(z)


def cheffing(x, y):
    z = x * y
    return z


def shang(x, y):
    z = x / y
    return z


num1 = int(input('第一个数：'))
num2 = int(input('第二个数：'))
z = shang(num1, num2)
print(z)

i = 1
s = 0
for i in range(1, 100):
    if i % 2 == 0:
        s -= i

    else:
        s += i
        i += 1
print(s)

# 银行利息
m = 10000
q = 0.0325
i = 0
while m <= 20000:
    m = m * (1 + q)
    i += 1
print(i)
print(m)

# 年龄
for x, y in range(1, 100):
    while abs(x - y) <= 8:
        if x * y == 6 * (x + y):
            print(x, y)

# 年龄
for i in range(1, 100):
    for j in range(1, i):
        if i * j == 6 * (i + j):
            print(i, j)
